import Vue from 'vue'
Vue.filter('formatDate', (val,type) => {
    let date = ''
    if(type == 3){
        date = new Date(val);
    }else{
        date = new Date(val);
    }

    let y = date.getFullYear();
    let MM = date.getMonth() + 1;
    MM = MM < 10 ? ('0' + MM) : MM;
    let d = date.getDate();
    d = d < 10 ? ('0' + d) : d;
    let h = date.getHours();
    h = h < 10 ? ('0' + h) : h;
    let m = date.getMinutes();
    m = m < 10 ? ('0' + m) : m;
    let s = date.getSeconds();
    s = s < 10 ? ('0' + s) : s;
    if(type === 2||type == 3){

        return y + '-' + MM + '-' + d;

    }else{
        return y+'-'+ MM + '-' + d + ' ' + h + ':' +m +':' + s;
    }

})